import React from 'react';


class Header extends React.Component {
	constructor() {
		super();
		this.state = {
			message: 'header',
			times: 0
		};
	}

	headerClick() {
		this.setState({
			times: ++this.state.times
		}, () => {
			console.log(`this.state.times had changed;`)
		})
	}

	render() {
		let {message, times} = this.state;
		let {list} = this.props;
		return (
			<div className="header">
				<span onClick={this.headerClick.bind(this)}>{message}</span>
				<p>{times}</p>
				<p>{list.join(',')}</p>
			</div>
		)
	}
}

export default Header;